package com.File;

import java.io.FileWriter;
import java.io.IOException;

public class writer {
    public static void main(String[] args) {
        String filePath = "e:\\note.txt";
        FileWriter fileWriter = null;
        char[] buf = {'a', 'g', 'c'};
        try {
            fileWriter = new FileWriter(filePath);
            fileWriter.write('h');
            fileWriter.write(buf);
            fileWriter.write("hello word".toCharArray(),0,5);
            fileWriter.write("你好");
            fileWriter.write("你好",0,2);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
